package cn.udinghuo.model.archives.bank;

import com.fasterxml.jackson.annotation.JsonSetter;

import org.springframework.util.Assert;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Column;
import cn.udinghuo.model.archives.bank.BankCategory;	
import cn.udinghuo.model.archives.bank.BankType;	
import cn.udinghuo.core.domain.entity.BaseEntity;	
import cn.udinghuo.core.domain.entity.Comment;
import cn.udinghuo.core.domain.entity.ita.CacheKey;

/**
 * @author ssk
 *	银行
 */
@Entity
@Table(name="bank")
public class SystemBank extends BaseEntity<Long>  {

	private static final long serialVersionUID = -318767105L;
	/**
	* 银行编码code
	*/
	@Comment(value="银行编码")
	@Column(name="cCode")
	private String code;
	/**
	* 银行名称name
	*/
	@Comment(value="银行名称")
	@Column(name="cName")
	private String name;
	/**
	* 银行图标image
	*/
	@Comment(value="银行图标")
	@Column(name="cImage")
	private String image;
	/**
	* 银行标记flag
	*/
	@Comment(value="银行标记")
	@Column(name="cFlag")
	private String flag;
	/**
	* 是否热门银行 是hot
	*/
	@Comment(value="是否热门银行 是")
	@Column(name="bHot")
	private Boolean hot;
	/**
	* 银行分类category
	*/
	@Comment(value="银行分类")
	@Column(name="iCategory")
	private Short category;
	/**
	* 手机图片phoneImage
	*/
	@Comment(value="手机图片")
	@Column(name="cPhoneImage")
	private String phoneImage;
	/**
	* 排序字段order
	*/
	@Comment(value="排序字段")
	@Column(name="iOrder")
	private Integer order;
	/**
	* 银行行号bankNo
	*/
	@Comment(value="银行行号")
	@Column(name="cBankNo")
	private String bankNo;
	/**
	* 银行类型 0普通类型 1虚拟银行type
	*/
	@Comment(value="银行类型 0普通类型 1虚拟银行")
	@Column(name="iType")
	private Short type;
	public String getCode() {
		return this.code;
	}
	
	public void setCode(String value) {
		this.code = value;
	}
	
	public String getName() {
		return this.name;
	}
	
	public void setName(String value) {
		this.name = value;
	}
	
	public String getImage() {
		return this.image;
	}
	
	public void setImage(String value) {
		this.image = value;
	}
	
	public String getFlag() {
		return this.flag;
	}
	
	public void setFlag(String value) {
		this.flag = value;
	}
	
	public Boolean getHot() {
		return this.hot;
	}
	
	public void setHot(Boolean value) {
		this.hot = value;
	}
	
	public BankCategory getCategory() {
        if(this.category == null){
			return null;
		}
		return BankCategory.find(this.category.intValue());
	}
	@JsonSetter
	public void setCategory(BankCategory value) {
		Assert.notNull(value, "enum value is invalid value!");
		this.category = value.getValue();
	}
	
	public void setCategory(Short value) {
		Assert.notNull(value,"enum value is invalid value!");
		Assert.notNull(BankCategory.find(value.intValue()),"enum value is invalid value!"); 
		this.category = value;
	}
	
	public String getPhoneImage() {
		return this.phoneImage;
	}
	
	public void setPhoneImage(String value) {
		this.phoneImage = value;
	}
	
	public Integer getOrder() {
		return this.order;
	}
	
	public void setOrder(Integer value) {
		this.order = value;
	}
	
	public String getBankNo() {
		return this.bankNo;
	}
	
	public void setBankNo(String value) {
		this.bankNo = value;
	}
	
	public BankType getType() {
        if(this.type == null){
			return null;
		}
		return BankType.find(this.type.intValue());
	}
	@JsonSetter
	public void setType(BankType value) {
		Assert.notNull(value, "enum value is invalid value!");
		this.type = value.getValue();
	}
	
	public void setType(Short value) {
		Assert.notNull(value,"enum value is invalid value!");
		Assert.notNull(BankType.find(value.intValue()),"enum value is invalid value!"); 
		this.type = value;
	}
	
}
